// pages/mch/car/detail.js
const App = getApp()
import Kits from '../../../utils/kits'
import Util from '../../../utils/util'

Page({
    data: {
        init: true,
        alertChecked: false,
    },
    onLoad(options) {
        wx.sub('ReloadCarList', this, () => {
            this.execLoad(this.data.car.id)
        })
        this.execLoad(options.cid)
    },
    onUnload() {
        wx.cancel('ReloadCarList', this)
    },
    showTip() {
        wx.showToast({
            title: '该价格仅其他商家可见',
            icon: 'none'
        })
    },
    execLoad(cid) {
        // App.doPost({
        //     uri: '/app/merchant/car/detail',
        //     body: {
        //         id: cid
        //     },
        //     fnSucc: resp => {
        //         resp.data.price.pdpStr = Kits.fmtMoneyString(resp.data.price.pdp)
        //         resp.data.price.pmpStr = Kits.fmtMoneyString(resp.data.price.pmp)
        //         resp.data.price.mdpStr = Kits.fmtMoneyString(resp.data.price.mdp)
        //         resp.data.price.depositStr = Kits.fmtMoneyString(resp.data.price.deposit)
        //         this.setData({
        //             init: true,
        //             car: resp.data,
        //         })
        //     }
        // })
    },
    notFinish() {
        Util.Toast.fail('暂不可用')
    },
    goToFence(e) {
        wx.navigateTo({
            url: `/pages/gps/cardetail/near?type=` + e.currentTarget.dataset.type,
        })
    }
})